<template>
  <el-dialog :title="'推送记录'" :visible.sync="dialogVisible" :close-on-click-modal="false" append-to-body width="70%">
    <div class="customTabNew">
      <div class="tabs flex alc">
        <el-radio-group :disabled="disabled" v-model="channelType" @change="tabChange">
          <el-radio-button :label="tab.value" v-for="tab in channelTypeList" :key="tab.value">{{ tab.name }}</el-radio-button>
        </el-radio-group>
      </div>
      <div class="content" v-if="channelType==2">
        <scriptPushRecRecords  :params="params" />
      </div>
      <div class="content" v-else>
        <pushRecords  :params="params" />
      </div>
      
      
    </div>
  </el-dialog>
</template>

<script>
import pushRecords from "@/views/interfaceManage/rec/index.vue";
import scriptPushRecRecords from "@/views/interfaceManage/scriptPushRec/index.vue";
export default {
  name: "push",
  components: { pushRecords, scriptPushRecRecords },
  data() {
    return {
      dialogVisible: false,
      loading: false,
      channelType: "1",
      params: {
        accountId: "",
        saleCode: "",
      },
      channelTypeList: [
        {
          name: "API接口",
          value: "1",
        },
        {
          name: "客服上架",
          value: "2",
        },
      ],
      disabled:false
    };
  },
  created() {
    // this.uploadImgUrl = process.env.VUE_APP_BASE_API + "/upload/image";
  },
  methods: {
    open(id, saleCode, channelType) {
      this.dialogVisible = true;
      this.disabled = false
      this.params = {
        accountId: "",
        saleCode: "",
      };
      this.params.accountId = id;
      if (saleCode) {
        this.params.saleCode = saleCode;
      }
      if (channelType) {
        this.channelType = channelType;
        this.disabled = true
      }
    },
    // tabs切换时触发
    tabChange(e) {
      console.log("%c Line:65 🍷 e", "color:#ed9ec7", e);
      this.channelType = e;
    },
    close() {
      this.dialogVisible = false;
    },
  },
};
</script>
<style scoped lang="css">
.center {
  text-align: center;
}
.tabs{
  margin-bottom: 0;
}
.content{
  border: 1px solid #e1e1e1;
}
::v-deep .app-container{
  min-height: auto;
}
::v-deep .el-dialog__body{
  padding-top: 10px !important;
}
</style>
